import * as vscode from "vscode";

/**
 * VS Code工具类
 * @description VS Code相关的工具方法集合
 * @author hans
 * @date 2025/4/23
 */
export class VsCodeUtil {
    /**
     * 显示一个会自动消失的状态栏消息
     * @param message 消息内容
     * @param timeout 自动消失的时间(毫秒)
     * @param command 点击消息时触发的命令
     * @param tooltip 鼠标悬停时的提示信息
     */
    public static showStatusMessage(
        message: string,
        timeout: number = 3000,
        command?: string,
        tooltip?: string
    ): void {
        const statusBarMessage = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
        statusBarMessage.text = `$(check) ${message}`;

        if (tooltip) {
            statusBarMessage.tooltip = tooltip;
        }

        if (command) {
            statusBarMessage.command = command;
        }

        statusBarMessage.show();

        setTimeout(() => {
            statusBarMessage.dispose();
        }, timeout);
    }
}
